package bsi.vn.Data;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

import bsi.vn.FirstApp.R;

import android.content.Context;
import android.graphics.Color;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class ContractServiceAreaAdapter extends ArrayAdapter<ContractServiceAreaData> {

	private Context context;
	private int resID;
	private ArrayList<ContractServiceAreaData> list;
	
	public ContractServiceAreaAdapter(Context context, int textViewResourceId,
			List<ContractServiceAreaData> objects) {
		super(context, textViewResourceId, objects);
		this.context = context;
		resID = textViewResourceId;
		list = (ArrayList<ContractServiceAreaData>) objects;
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if(convertView==null) 
        { 
            LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
            convertView=inflater.inflate(R.layout.contract_servicearea_item, null);                     
        }
		TextView name = (TextView) convertView.findViewById(R.id.tvCSName);
		TextView com = (TextView) convertView.findViewById(R.id.tvCSCom);
		TextView not = (TextView) convertView.findViewById(R.id.tvCSNote);
		
		ContractServiceAreaData s = list.get(position);
		name.setText(s.getnam());
		com.setText(s.getcom()+" hours");
		not.setText(s.getnot());
		
		return convertView;
	}
	

}
